local key = KEYS[1]
local key1 = KEYS[2]
local value = redis.call('get', key)
local argv = ARGV[1]
if value then
  value = value
else
  value = 0
end
if(tonumber(value)<1000 and redis.call('INCR', key)) then
    if (redis.call('rPush','DB_QUEUE',argv) and redis.call('rPush','DB_QUEUECOPY',argv)) then
        return '1'
    else
        redis.call('DECR', key)
        return '0'
    end
else
    return '-1'
end
